﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CapaPresentacion.Converters
{
    class IsCheckedToIsEnabledConverter : System.Windows.Data.IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Boolean? booleanValue = value as Boolean?;

            if (booleanValue.HasValue ? booleanValue.Value : false)
            {
                return false;
            }
            else
            {
                return true;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Boolean? booleanValue = value as Boolean?;

            return booleanValue.Value;
        }
    }
}
